#include "QLocalMsgBox.h"
#include <windows.h>
#include <QWidget>

const unsigned int UserIcon				= 128;
const unsigned int IconAsterisk			= 64;
const unsigned int IconExclamation		= 0x30;
const unsigned int IconWarning			= 0x30;
const unsigned int IconError			= 16;
const unsigned int IconHand				= 16;
const unsigned int IconQuestion			= 32;
const unsigned int Ok					= 0;
const unsigned int AbortRetryIngnore	= 2;
const unsigned int Help					= 0x4000;
const unsigned int Right				= 0x80000;
const unsigned int RtlReading			= 0x100000;
//const unsigned int TopMost				= 0x40000;
const unsigned int DefButton1			= 0;
const unsigned int DefButton2			= 256;
const unsigned int DefButton3			= 512;
const unsigned int DefButton4			= 0x300;
const unsigned int IconInformation		= 64;
const unsigned int IconStop				= 16;
const unsigned int OkCancel				= 1;
const unsigned int RetryCancel			= 5;

const unsigned int YesNo				= 4;
const unsigned int YesNoCancel			= 3;
const unsigned int IconMask				= 240;
const unsigned int DefMask				= 3840;
const unsigned int ModeMask				= 0x00003000;
const unsigned int MiscMask				= 0x0000C000;
const unsigned int NoFocus				= 0x00008000;
const unsigned int TypeMask				= 15;
const unsigned int TopMost				= 0x40000;

const unsigned int IdOk					= 1;
const unsigned int IdCancel				= 2;
const unsigned int IdAbort				= 3;
const unsigned int IdRetry				= 4;
const unsigned int IdIgnore				= 5;
const unsigned int IdYes				= 6;
const unsigned int IdNo					= 7;

unsigned int QLocalMsgBox::messageBox(QWidget* par,const QString& title,const QString& text,
							   const unsigned int flag)
{
	return MessageBoxA(par->winId(),qPrintable(text),qPrintable(title),flag);
}

unsigned int QLocalMsgBox::informationBox(QWidget* par,const QString& title,const QString& text)
{
	return MessageBoxA(par->winId(),qPrintable(text),qPrintable(title),MB_OK | MB_ICONINFORMATION);
}

unsigned int QLocalMsgBox::questionBox(QWidget* par,const QString& title,const QString& text)
{
	return MessageBoxA(par->winId(),qPrintable(text),qPrintable(title),MB_ICONQUESTION | MB_YESNO);
}

unsigned int QLocalMsgBox::warningBox(QWidget* par,const QString& title,const QString& text)
{
	return MessageBoxA(par->winId(),qPrintable(text),qPrintable(title),MB_ICONWARNING | MB_YESNO);
}

unsigned int QLocalMsgBox::errorBox(QWidget* par,const QString& title,const QString& text)
{
	return MessageBoxA(par->winId(),qPrintable(text),qPrintable(title),MB_ICONERROR | MB_OK);
}

QLocalMsgBox::QLocalMsgBox(void)
{
}

QLocalMsgBox::~QLocalMsgBox(void)
{
}
